import request from '@/utils/request'

// 查询景区信息列表
export function listScenic(query) {
  return request({
    url: '/system/scenic/list',
    method: 'get',
    params: query
  })
}

// 查询景区列表（排除子节点）
export function listScenicExcludeChild(scenicId) {
  return request({
    url: '/system/scenic/list/exclude/' + scenicId,
    method: 'get'
  })
}

// 查询景区信息详细
export function getScenic(scenicId) {
  return request({
    url: '/system/scenic/' + scenicId,
    method: 'get'
  })
}

// 新增景区信息
export function addScenic(data) {
  return request({
    url: '/system/scenic',
    method: 'post',
    data: data
  })
}

// 修改景区信息
export function updateScenic(data) {
  return request({
    url: '/system/scenic',
    method: 'put',
    data: data
  })
}

// 删除景区信息
export function delScenic(scenicId) {
  return request({
    url: '/system/scenic/' + scenicId,
    method: 'delete'
  })
}

// 景区运营状态修改
export function changeScenicOperationStatus(scenicId, operationStatus) {
  console.log("changeScenicOperationStatus scenicId: ", scenicId)
  console.log("changeScenicOperationStatus operationStatus: ", operationStatus)
  const data = {
    scenicId,
    operationStatus
  }
  return request({
    url: '/system/scenic/changeOperationStatus',
    method: 'put',
    data: data
  })
}

/**
 * 更新景区的运营时间及运营状态切换模式。
 * @param data
 * @returns {*}
 */
export function updateOperationTimeAndSwitchMode(data) {
  return request({
    url: '/system/scenic/updateOperationTimeAndSwitchMode',
    method: 'put',
    data: data
  })
}
